// packageAPI/pages/system/all/all.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    value:'getRendererUserAgent',
    usable:'',
    devicelnfo:{},
    systemInfo:{},
    ua:'',
    title:'微信'
  },
  onShareAppMessage(p){
    return {
      title: '获取位置',
      path: 'packageAPI/pages/system/all/all'
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.setData({
      devicelnfo:wx.getDeviceInfo(),
      systemInfo:wx.getSystemInfoSync()
    })
    wx.getRendererUserAgent({
      success:(res)=>{
        console.log(res)
        this.setData({
          ua:res.userAgent
        })
      }
    })
    this.checkApi()
  },

  checkApi() {
    let value = this.data.value
    if(value.startsWith('wx.')) {
      value = value.slice(3)
    }
    let res = wx.canIUse(value)
    this.setData({
      usable:res
    })
  },
  apiChange(e){
    this.setData({
      value:e.detail.value
    })
  }
})